package org.example.facade.panel;

import javafx.scene.canvas.GraphicsContext;
import org.example.physics_engine.body.PhysicsBody;
import org.example.physics_engine.geometry.shapes.AbstractShape;
import org.example.facade.component.Component_Type;

public class GizmoPhysicsBody extends PhysicsBody implements PanelRenderer{
    private Component_Type componentType;

    /**
     * 反序列化用
     */
    @Deprecated
    public GizmoPhysicsBody() {
        super();
    }

    public GizmoPhysicsBody(AbstractShape shape) {
        super(shape);
    }

    public GizmoPhysicsBody(AbstractShape shape, Component_Type gizmoType) {
        super(shape);
        this.componentType = gizmoType;
    }

    public void drawToCanvas(GraphicsContext graphicsContext) {
        drawToCanvas(graphicsContext, this);
    }

    @Override
    public void drawToCanvas(GraphicsContext graphicsContext, PhysicsBody physicsBody) {
        componentType.getPanelRenderer().drawToCanvas(graphicsContext, physicsBody);
    }

    public Component_Type getComponentType() {
        return componentType;
    }

    public void setComponentType(Component_Type componentType) {
        this.componentType = componentType;
    }
}
